self.onmessage = (event) => {
    const { data } = event;
    const { action, args } = data;
    switch (action) {
        case 'importScripts': {
            const { scriptPath } = args;
            importScripts(scriptPath);
        }; break;
        case 'startWorker': {
            const res = calcSomething(args);
            self.postMessage(res);
        }; break;
        case 'close': {
            self.close();
        }; break;
        default: { };
    }
}